package org.afun.oldhand.order.fragment;

import android.content.DialogInterface;
import android.os.Bundle;

import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;

import org.afun.oldhand.R;
import org.afun.oldhand.base.BaseFragment;
import org.afun.oldhand.order.adapter.OrderItem1Adater;
import org.afun.oldhand.order.javaBean.Item1Bean;
import org.afun.oldhand.user.activity.user_item1_4;

import java.util.ArrayList;
import java.util.List;

/**
 * A simple {@link Fragment} subclass.
 * Use the {@link Order1Fragment#newInstance} factory method to
 * create an instance of this fragment.
 */
public class Order1Fragment extends BaseFragment {
    private View view;
    private List<Item1Bean> data = new ArrayList<>();

    public Order1Fragment() {
        // Required empty public constructor
    }

    public static Order1Fragment newInstance(String param1, String param2) {
        Order1Fragment fragment = new Order1Fragment();
        return fragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        return initView();
    }

    public View initView() {
        if (view == null){
            view = View.inflate(mContext,R.layout.fragment_order1,null);
        }
        RecyclerView recyclerView = view.findViewById(R.id.rv);
        data.add(new Item1Bean(R.drawable.dickhead,"xxx1教练","三小时陪练","￥250","12:45",R.drawable.order1,"10086"));
        data.add(new Item1Bean(R.drawable.dickhead,"xxx2教练","三小时陪练","￥250","12:45",R.drawable.order1,"10086"));

        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this.mContext);
        recyclerView.setLayoutManager(linearLayoutManager);

        OrderItem1Adater orderItem1Adater  = new OrderItem1Adater(data,this.mContext);
        recyclerView.setAdapter(orderItem1Adater);

        orderItem1Adater.setOrderItem1ClickListener(new OrderItem1Adater.OnOrderRecyclerItem1ClickListener() {
            @Override
            public void onItem1RecyclerItemClick(int position) {
                Log.e("textOrder1", "onItem1RecyclerItemClick: " +position );
            }


        });



        return view;
    }
}